package com.yyj.qy163springboot.controller;

import com.yyj.qy163springboot.pojo.Student;
import com.yyj.qy163springboot.service.Studentservice;
import com.yyj.qy163springboot.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: qy163sringboot
 * @description:
 * @author: 杨英俊
 * @create: 2023-04-10 19:32
 **/
@RestController
public class StudentController {
    @Autowired
    private Studentservice studentservice;
    @GetMapping("getAll")
    public Result getAll(){
        return studentservice.queryAll();
    }
    @PutMapping("save")
    public Result save( @RequestBody Student student){
        return studentservice.save(student);
    }

    @DeleteMapping("delete/{id}")
    public Result delete(@PathVariable Integer id){
        return studentservice.delete(id);
    }

    @PutMapping("update")
    public Result update(@RequestBody Student student){
        return studentservice.update(student);
    }
}
